package cz.proks.easyhelpdesk.gwt.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;

import cz.proks.easyhelpdesk.api.model.User;

public class MemberDeleteEvent extends GwtEvent<MemberDeleteEvent.Handler>{
    public final static Type<MemberDeleteEvent.Handler> TYPE = new Type<MemberDeleteEvent.Handler>();
    
    public static interface Handler extends EventHandler {
        void onMemberDelete(MemberDeleteEvent event);
    }
    
    private final User user;    

    public MemberDeleteEvent(User user) {
        super();
        this.user = user;
    }
    
    public static void fireEvent(HasMemberDeleteHandlers source, User user) {
        source.fireEvent(new MemberDeleteEvent(user));
    }
    
    public User getMember() {
        return user;
    }    

    @Override
    public com.google.gwt.event.shared.GwtEvent.Type<MemberDeleteEvent.Handler> getAssociatedType() {
        return TYPE;
    }

    @Override
    protected void dispatch(MemberDeleteEvent.Handler handler) {
        handler.onMemberDelete(this);
    }        
}
